<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath() + "/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<base href="<%=basePath%>">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<title>我的文章</title>

<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/user-list.css">

</head>
<body>



	<div class="user-list">


		<c:choose>
			<c:when test="${!empty myEssayList}">
				<form id="form-1" name="userListForm" action="DeleteAllEssay"
					method="post">
					<table>
						<caption>我的文章列表</caption>
						<tr>
							<th>选择</th>
							<th>ID</th>
							<th>标题</th>
							<th>版本</th>
							<th>密级</th>
							<th>审核</th>
							<th>发布时间</th>
							<th>操作</th>

							<!--  id, title, version, thick, audit, publish_date  -->

						</tr>
						<c:forEach items="${myEssayList}" var="essay" varStatus="st">
							<!--通过varStatus的属性（index count first last）count(当前记录号)%2 判断是否是偶数行  -->

							<!-- 设置偶数行的背景颜色为 类class bg1 -->
							<tr class="${st.count%2==0?"tr-1":"tr-2"}">





								<td><input type="checkbox" name="delID" value="${essay.id}"></td>
								<td>${essay.id}</td>
								<td>${essay.title}</td>
								<td>${essay.version}</td>
								<td><c:choose>
										<c:when test="${essay.thick==1}">
										个人
										</c:when>


										<c:when test="${essay.thick==2}">
										部门
										</c:when>


										<c:when test="${essay.thick==3}">
										企业
										</c:when>


										<c:when test="${essay.thick==4}">
										公告
										</c:when>

									</c:choose></td>
								<td><c:choose>

										<c:when test="${essay.audit==0}">待审核</c:when>
										<c:when test="${essay.audit==1}">通过</c:when>
										<c:when test="${essay.audit==2}">未通过</c:when>



									</c:choose></td>
								<td><fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss"
										value="${essay.publishDate}" type="both" /></td>
								<td><a href="FindEssay?id=${essay.id}">查看</a> | <a
									href="UpdateEssay?id=${essay.id}">修改</a> | <a
									href="DeleteEssay?id=${essay.id}"
									onclick="javascirpt:return delConfirm();">删除</a></td>

							</tr>


						</c:forEach>
					</table>
					<div class="bottom">
						<!--分页数据放在pageBean中，通过EL表达式语言输出其当前的值-->

						<input class="button-1" id="select-all" type="button" value="全选">

						<input class="button-2" type="submit" value="批量删除">

						共有${pageBean.recordCnt}条记录 共${pageBean.pageCnt}页
						当前是第${pageBean.curPage}页 转到第 <select id="page-sel">
							<c:forEach begin="1" end="${pageBean.pageCnt}" step="1"
								var="pageNum">
								<option ${pageBean.curPage==pageNum?"selected=\"selected\"":""}
									value="${pageNum}">${pageNum}</option>
							</c:forEach>
						</select> 页 <input class="button-3" id="goto-page" type="button" value="GO">

						<input class="button-1" id="goto-page" type="button"
							onclick="javaScript:toPage('1')" value="首页"> <input
							class="button-1" id="goto-page" type="button"
							onclick="javaScript:toPage('${pageBean.prePage}')" value="上页">
						<input class="button-1" id="goto-page" type="button"
							onclick="javaScript:toPage('${pageBean.nextPage}')" value="下页">
						<input class="button-1" id="goto-page" type="button"
							onclick="javaScript:toPage('${pageBean.pageCnt}')" value="尾页">

					</div>
				</form>
			</c:when>
			<c:otherwise>
				<p class="err-info">你还没有发布过文章哦！</p>
			</c:otherwise>
		</c:choose>
	</div>

	<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="js/my-essay-list.js"></script>


</body>
</html>